IF EXISTS (SELECT * FROM sysobjects WHERE name = 'SelectRubrIngre' AND user_name(uid) = 'dbo')
	DROP PROCEDURE [dbo].SelectRubrIngre
GO

CREATE PROCEDURE [dbo].SelectRubrIngre
AS
	SET NOCOUNT ON;
SELECT     psrbring.*
FROM         psrbring
GO

IF EXISTS (SELECT * FROM sysobjects WHERE name = 'InsertRubrIngre' AND user_name(uid) = 'dbo')
	DROP PROCEDURE [dbo].InsertRubrIngre
GO

CREATE PROCEDURE [dbo].InsertRubrIngre
(
	@rbicodigo char(20),
	@rbialtern char(20),
	@rbinombre char(50),
	@estniveli char(1),
	@rbicodmay char(20),
	@rbiingapr char(15),
	@rbiingxej char(15),
	@rbirecefe char(15),
	@rbirecpap char(15),
	@rbiotscan char(15),
	@rbirecons char(15),
	@rbiingnaf char(15),
	@rbirecvga char(15),
	@rbirecxev char(15),
	@rbirxrvga char(15)
)
AS
	SET NOCOUNT OFF;
INSERT INTO [psrbring] ([rbicodigo], [rbialtern], [rbinombre], [estniveli], [rbicodmay], [rbiingapr], [rbiingxej], [rbirecefe], [rbirecpap], [rbiotscan], [rbirecons], [rbiingnaf], [rbirecvga], [rbirecxev], [rbirxrvga]) VALUES (@rbicodigo, @rbialtern, @rbinombre, @estniveli, @rbicodmay, @rbiingapr, @rbiingxej, @rbirecefe, @rbirecpap, @rbiotscan, @rbirecons, @rbiingnaf, @rbirecvga, @rbirecxev, @rbirxrvga);
	
SELECT rbicodigo, rbialtern, rbinombre, estniveli, rbicodmay, rbiingapr, rbiingxej, rbirecefe, rbirecpap, rbiotscan, rbirecons, rbiingnaf, rbirecvga, rbirecxev, rbirxrvga FROM psrbring WHERE (rbicodigo = @rbicodigo)
GO

IF EXISTS (SELECT * FROM sysobjects WHERE name = 'UpdateRubrIngre' AND user_name(uid) = 'dbo')
	DROP PROCEDURE [dbo].UpdateRubrIngre
GO

CREATE PROCEDURE [dbo].UpdateRubrIngre
(
	@rbicodigo char(20),
	@rbialtern char(20),
	@rbinombre char(50),
	@estniveli char(1),
	@rbicodmay char(20),
	@rbiingapr char(15),
	@rbiingxej char(15),
	@rbirecefe char(15),
	@rbirecpap char(15),
	@rbiotscan char(15),
	@rbirecons char(15),
	@rbiingnaf char(15),
	@rbirecvga char(15),
	@rbirecxev char(15),
	@rbirxrvga char(15),
	@Original_rbicodigo char(20),
	@Original_rbialtern char(20),
	@Original_rbinombre char(50),
	@Original_estniveli char(1),
	@Original_rbicodmay char(20),
	@Original_rbiingapr char(15),
	@Original_rbiingxej char(15),
	@Original_rbirecefe char(15),
	@Original_rbirecpap char(15),
	@Original_rbiotscan char(15),
	@Original_rbirecons char(15),
	@Original_rbiingnaf char(15),
	@Original_rbirecvga char(15),
	@Original_rbirecxev char(15),
	@Original_rbirxrvga char(15)
)
AS
	SET NOCOUNT OFF;
UPDATE [psrbring] SET [rbicodigo] = @rbicodigo, [rbialtern] = @rbialtern, [rbinombre] = @rbinombre, [estniveli] = @estniveli, [rbicodmay] = @rbicodmay, [rbiingapr] = @rbiingapr, [rbiingxej] = @rbiingxej, [rbirecefe] = @rbirecefe, [rbirecpap] = @rbirecpap, [rbiotscan] = @rbiotscan, [rbirecons] = @rbirecons, [rbiingnaf] = @rbiingnaf, [rbirecvga] = @rbirecvga, [rbirecxev] = @rbirecxev, [rbirxrvga] = @rbirxrvga WHERE (([rbicodigo] = @Original_rbicodigo) AND ([rbialtern] = @Original_rbialtern) AND ([rbinombre] = @Original_rbinombre) AND ([estniveli] = @Original_estniveli) AND ([rbicodmay] = @Original_rbicodmay) AND ([rbiingapr] = @Original_rbiingapr) AND ([rbiingxej] = @Original_rbiingxej) AND ([rbirecefe] = @Original_rbirecefe) AND ([rbirecpap] = @Original_rbirecpap) AND ([rbiotscan] = @Original_rbiotscan) AND ([rbirecons] = @Original_rbirecons) AND ([rbiingnaf] = @Original_rbiingnaf) AND ([rbirecvga] = @Original_rbirecvga) AND ([rbirecxev] = @Original_rbirecxev) AND ([rbirxrvga] = @Original_rbirxrvga));
	
SELECT rbicodigo, rbialtern, rbinombre, estniveli, rbicodmay, rbiingapr, rbiingxej, rbirecefe, rbirecpap, rbiotscan, rbirecons, rbiingnaf, rbirecvga, rbirecxev, rbirxrvga FROM psrbring WHERE (rbicodigo = @rbicodigo)
GO

IF EXISTS (SELECT * FROM sysobjects WHERE name = 'DeleteRubrIngre' AND user_name(uid) = 'dbo')
	DROP PROCEDURE [dbo].DeleteRubrIngre
GO

CREATE PROCEDURE [dbo].DeleteRubrIngre
(
	@Original_rbicodigo char(20),
	@Original_rbialtern char(20),
	@Original_rbinombre char(50),
	@Original_estniveli char(1),
	@Original_rbicodmay char(20),
	@Original_rbiingapr char(15),
	@Original_rbiingxej char(15),
	@Original_rbirecefe char(15),
	@Original_rbirecpap char(15),
	@Original_rbiotscan char(15),
	@Original_rbirecons char(15),
	@Original_rbiingnaf char(15),
	@Original_rbirecvga char(15),
	@Original_rbirecxev char(15),
	@Original_rbirxrvga char(15)
)
AS
	SET NOCOUNT OFF;
DELETE FROM [psrbring] WHERE (([rbicodigo] = @Original_rbicodigo) AND ([rbialtern] = @Original_rbialtern) AND ([rbinombre] = @Original_rbinombre) AND ([estniveli] = @Original_estniveli) AND ([rbicodmay] = @Original_rbicodmay) AND ([rbiingapr] = @Original_rbiingapr) AND ([rbiingxej] = @Original_rbiingxej) AND ([rbirecefe] = @Original_rbirecefe) AND ([rbirecpap] = @Original_rbirecpap) AND ([rbiotscan] = @Original_rbiotscan) AND ([rbirecons] = @Original_rbirecons) AND ([rbiingnaf] = @Original_rbiingnaf) AND ([rbirecvga] = @Original_rbirecvga) AND ([rbirecxev] = @Original_rbirecxev) AND ([rbirxrvga] = @Original_rbirxrvga))
GO

